const Koa = require("koa");
const router = require("koa-router")();
const bodyParser = require("koa-bodyparser");
const {userController} = require("./Controller/user")
const control = require("../add")
const app = new Koa();
app.use(bodyParser());
app.use(control())
app.use(router.routes(), router.allowedMethods());

// 注册的请求
router.post("/user/registry",userController.registry)
// 登录的请求
router.post("/user/login",userController.login)
// 增删改查
router.post("/user/add",userController.add)  // 添加
router.get("/user/gets",userController.gets)   // 获取
router.delete("/user/del",userController.del)    // 删除
router.put("/user/edit",userController.edit)       // 编辑

app.listen(3000, () => {
  console.log("server is runing at http://localhost:3000");
});
